[HVM] Fix the APM BIOS to ensure that interrupts are enabled when it
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 18 Aug 2006 15:20:45 +0000 (16:20 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 18 Aug 2006 15:20:45 +0000 (16:20 +0100)
executes an idling HLT. This allow us to re-enable the 'shutdown on
HLT-with-interrupts-disabled' heuristic.

Signed-off-by: Keir Fraser <keir@xensource.com>
tools/firmware/rombios/apmbios.S
xen/arch/x86/hvm/hvm.c

index df8e106129e244414a0608bdf0aa8de3d0be4daf..a010949f7d0a6048d5e490a0dd49f1c2d1e34f66 100644 (file)
@@ -225,7 +225,10 @@ APMSYM(04):
 APMSYM(05):
   cmp al, #0x05
   jne APMSYM(07)
+  pushf ; XEN
+  sti   ; XEN: OS calls us with ints disabled -- better re-enable here!
   hlt
+  popf  ; XEN
   jmp APMSYM(ok)
 
 ;-----------------
index 2e78d2fe6befa222e9e00057d8c01285d5301b84..48806c000e801d1df28d2f48235cc03304b0781a 100644 (file)
@@ -345,13 +345,13 @@ int cpu_get_interrupt(struct vcpu *v, int *type)
     return -1;
 }
 
+#include <asm/hvm/vmx/vmx.h>
 void hvm_hlt(unsigned long rflags)
 {
     struct vcpu *v = current;
     struct periodic_time *pt = &v->domain->arch.hvm_domain.pl_time.periodic_tm;
     s_time_t next_pit = -1, next_wakeup;
 
-#if 0 /* This seems to fire at unwelcome times in Linux */
     /*
      * Detect machine shutdown.  Only do this for vcpu 0, to avoid potentially 
      * shutting down the domain early. If we halt with interrupts disabled, 
@@ -360,12 +360,11 @@ void hvm_hlt(unsigned long rflags)
      */
     if ( (v->vcpu_id == 0) && !(rflags & X86_EFLAGS_IF) )
     {
-        printk("D%d: HLT with interrupts enabled -- shutting down.\n",
+        printk("D%d: HLT with interrupts disabled -- shutting down.\n",
                current->domain->domain_id);
         domain_shutdown(current->domain, SHUTDOWN_poweroff);
         return;
     }
-#endif /* 0 */
 
     if ( !v->vcpu_id )
         next_pit = get_scheduled(v, pt->irq, pt);